/*
  保养预警页面
*/
import { request } from "./request";
//获取所有header信息
export function getHeaderInfo (params) {
  return request({
      url: '/Mainte/Headers',
      params:{
        ...params
      }
  })
}
//新增header信息
export function AddHeaderInfo (params) {
  return request({
      url: '/Mainte/Header',
      data:params,
      method:'post'
  })
}
//更新header信息
export function EditHeaderInfo (params) {
  return request({
      url: '/Mainte/Header/' + params.id,
      data:params,
      method:'put'
  })
}
//维护保养、储存等的库房货架信息
export function getStoreInfo (params) {
  return request({
      url: '/Mainte/StoreRooms/Cascade',
      params:{
        ...params
      }
  })
}
//第一次扫描跳转判断SN是否存在
export function getSnExists (params) {
  return request({
      url: `/Mainte/Headers/SN/Exists/${params.headSN}`,   
  })
}
//报废Head维护
export function fetchScrapedHeadMainte (params) {
    return request({
        url: '/Mainte/Header/Scraped',
        data: params,
        method: 'put'
    })
}

/*
  保养记录页面
*/

/** MainteInfoRecord */
// 周保养
export function getWeekMaintain(params) {
    return request({
        url: `/Mainte/Header/SN/${params.headSN}/week/MainteInfoRecords`,
        params: {
            ...params
        },

    })
}

//月保养
export function getMonthMaintain(params) {
    return request({
        url: `/Mainte/Header/SN/${params.headSN}/month/MainteInfoRecords`,
        params: {
            ...params
        },

    })
}
// all
export function getAllMaintain(params) {
    return request({
        url: `/Mainte/Header/SN/${params.headSN}/all/MainteInfoRecords`,
        params: {
            ...params
        },

    })
}
export function getHeadMaintainHistory(params) {
    return request({
        url: `/Mainte/Header/MainteInfoRecords`,
        params: {
            ...params
        },

    })
}

//季保养
export function getQuarterMaintain(params) {
    return request({
        url: `/Mainte/Header/SN/${params.headSN}/quarter/MainteInfoRecords`,
        params: {
            ...params
        }
    })
}

//年保养
export function getYearMaintain(params) {
    return request({
        url: `/Mainte/Header/SN/${params.headSN}/year/MainteInfoRecords`,
        params: {
            ...params
        }
    })
}

//新增周月季年保养
export function AddMaintainRecord(params) {
    return request({
        url: `/Mainte/Header/MainteInfoRecord`,
        //data就是body参数
        //params就是query参数
        data: params,
        method: 'post'
    })
}
//编辑周/月/季/年保养记录
export function EditMaintainRecord(params) {
    return request({
        url: `/Mainte/Header/MainteInfoRecord`,
        data: params,
        method: 'put'
    })
}
